/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.javlov.vf;

import java.io.Serializable;

/**
 * Stores a single state or option value. This class was purely created for the purpose of providing
 * a direct pointer to values stored in a value table, without having to do a lookup.
 * 
 * @author Matthijs Snel
 *
 */
public class Value implements Serializable, Comparable<Value> {

	private static final long serialVersionUID = 7083761916807075678L;
	private double value;
	public Value(double v) {
		value = v;
	}
	public void set(double v) {
		value = v;
	}
	public double get() {
		return value;
	}
	public void add(double delta) {
		value += delta;
	}
	public String toString() {
		return "" + value;
	}
	@Override
	public int compareTo(Value o) {
		return Double.compare(value, o.get());
	}
}
